//继承模板
{extend name="public/base"}


//CSS
{block name="style"}
<link rel="stylesheet" href="__ADMIN_STATIC__/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
{/block}


{block name="breadcrumb" title="当前位置"}{/block}

//正文区域
{block name="body"}{//---------------------------------------------------------------------------}
<div class="page-container">

    <div class="cl pd-5 bg-1 bk-gray mb-10">
<div style="line-height:28px; padding:5px;">
    <b>用章流程：</b><br/>
        
        1.选择用章流程 &nbsp;&nbsp; -> &nbsp;&nbsp; 
        <b style=" color:#f11;">2.提交申请信息 </b>&nbsp;&nbsp; -> &nbsp;&nbsp; 
        3.等待审核 &nbsp;&nbsp; -> &nbsp;&nbsp; 
        4.盖章操作 
        <br/>

        <b>当前操作：</b><b style=" color:#f11;">2.提交申请信息</b>


</div>
    </div>

    
    <form action="" method="post" class="form form-horizontal" id="form1">


        <fieldset><legend>申请信息</legend>
{if ($info.id)}
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">申请编号:</label>
            <div class="formControls col-xs-8 col-sm-5">
                {$info.code|default="**********"}
            </div>
            <div class="formControls col-xs-8 col-sm-5">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">申请人:</label>
            <div class="formControls col-xs-8 col-sm-5">
                [{$info.apply_user_id |default=""}]   {$info.user.username|default=""} 
            </div>
            <div class="formControls col-xs-8 col-sm-5">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">申请流程:</label>
            <div class="formControls col-xs-8 col-sm-5">
                  [{$info.process_id|default=""}]    {$info.process.name|default=""} 
            </div>
            <div class="formControls col-xs-8 col-sm-5">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">当前状态:</label>
            <div class="formControls col-xs-8 col-sm-5">
                {$info.status|default=""}{$info.status_text|default=""}
            </div>
            <div class="formControls col-xs-8 col-sm-5">
            </div>
        </div>
{/if}


{if ($type_id == 1 || $info.type_id == 1 )}
        <input type="hidden" name="type_id" value="1" />
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>用章次数:</label>
            <div class="formControls col-xs-8 col-sm-5">
                <span class="select-box">
                <select class="select valid" name="max_times">{$info.max_times}
                <?php for( $i=1 ; $i<11 ; $i++): ?>
                        <option value="{$i}" {eq name="i" value="$info.max_times|default=1"}selected{/eq}>{$i}次</option>
                <?php endfor;?>
                </select>
                </span>
            </div>
            <div class="formControls col-xs-8 col-sm-5">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>有效期:</label>
            <div class="formControls col-xs-8 col-sm-5">
                <span class="select-box">
                <select class="select valid" name="exp_time_day">
                <?php for( $i=1 ; $i<8 ; $i++): ?>
                        <option value="{$i}" {eq name="i" value="$info.exp_time_day|default=7"}selected{/eq}>{$i}天内</option>
                <?php endfor;?>
                </select>
                </span>
            </div>
            <div class="formControls col-xs-8 col-sm-5">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>用章事由:</label>
            <div class="formControls col-xs-8 col-sm-5">
                <input type="text" class="input-text" value="{$info.info|default=''}" placeholder="" name="info" data-rule-required="true" />
            </div>
            <div class="formControls col-xs-8 col-sm-5">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>上传附件:</label>
            <div class="formControls col-xs-8 col-sm-5">

                <div class="upload-box" kindeditor="uploadbuttonB">
{volist name="info.attachs|default=[]" id="vo" index="index"}    
<div class="item">
    <a class="del"></a>
    <a href="{$vo.url}" data-lightbox="image-{$vo.id}" data-title="{$vo.title}">
        <img src="{$vo.url}" keimg="">   
    </a>
    <input type="hidden" name="attach[]" value="{$vo.id}" keattach="">
</div>
{/volist}
                    <input type="button"  value="上传文件" KEbtn />
                </div>

            </div>
            <div class="formControls col-xs-8 col-sm-5">

            </div>
        </div>

{else}
    <input type="hidden" name="type_id" value="2" />
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>维护设备:</label>
            <div class="formControls col-xs-8 col-sm-5">
                <strong>{$info.equipment.equipment_name}{$process.equipment.equipment_name}</strong>
            </div>
            <div class="formControls col-xs-8 col-sm-5">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>有效期:</label>
            <div class="formControls col-xs-8 col-sm-5">
                <span class="select-box">
                <select class="select valid" name="exp_time_day">
                <?php for( $i=1 ; $i<8 ; $i++): ?>
                        <option value="{$i}" {eq name="i" value="$info.exp_time_day|default=7"}selected{/eq}>{$i}天内</option>
                <?php endfor;?>
                </select>
                </span>
            </div>
            <div class="formControls col-xs-8 col-sm-5">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>维护事由:</label>
            <div class="formControls col-xs-8 col-sm-5">
                <input type="text" class="input-text" value="{$info.info|default=''}" placeholder="" name="info" data-rule-required="true" />
            </div>
            <div class="formControls col-xs-8 col-sm-5">
            </div>
        </div>

{/if}


        <div class="row cl">
            <div class="col-xs-8 col-sm-5 col-xs-offset-4 col-sm-offset-2">
                <input type="hidden" name="id"  value="{$info.id|default=0}"/>
                <input type="hidden" name="process_id"  value="{$info.process_id ? $info.process_id : $process_id}"/>

                <input type="hidden" name="status"  value="0"/>
                <button class="btn btn-primary radius" type="button" onclick="save()"><i class="Hui-iconfont">&#xe632;</i> 保存 </button>

                <button class="btn btn-primary radius" type="button" onclick="savaandsubmit()"><i class="Hui-iconfont">&#xe632;</i> 保存并提交申请 </button>

                <button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>

                


            </div>
        </div>

        </fieldset>

        

    </form>
</div>




{/block}
//-----------------------------------------------------------------------------------------------


<!--请在下方写此页面业务相关的脚本-->
//-----------------------------------------------------------------------------------------------
{block name="script"}
<script type="text/javascript">


function save(){
   $('input[name=status]').val(0);
   $('#form1').submit();
   return false;
}
function savaandsubmit(){
   layer.confirm('确认要【保存并提交申请】吗？<br/> 提交后，进入审核流程，<br/>无法修改哦～～～',function(index){
       layer.closeAll('dialog');
       $('input[name=status]').val(1);
       $('#form1').submit();
    }); 

}

$(function(){
    //返回顶部
    $.Huitotop();

    //表单验证 提交
    $('#form1').on('submit',function(){
        jBox.tip('loading...' , 'loading') ; 
        var $form  = $("form");
        var url = $form.attr('action');
        var type = $form.attr('method') || 'post';
        var data = $form.serialize();
        $.ajax({
            url: url ,
            type:type , // get post
            data: data , 
            dataType : 'html' ,
            success:function(d){
                try{d = JSON.parse(d);}catch(err){jBox.alert( d , '查看ajax返回值');return false;}
                if( 1 == d.code){
                    jBox.tip( d.msg , 'success');
                    setTimeout(function(){layer_close(1);},1000);
                }else{
                    jBox.tip( d.msg , 'error');
                }
            },
            error:function(XMLHttpRequest, textStatus, errorThrown){
                console.log( 'ajaxError : ' + textStatus );
            },
            complete:function(){
                setTimeout(function(){jBox.closeTip();},3000);
            }
        });
        return false;
    });

    //


    
});

//--------------------------------------------




</script>

<style>
    

    
</style>



{/block}{//---------------------------------------------------------------------------}